package com.cmw;

import com.cmw.controller.global.interceptor.WebRequestInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SpringBootApplication
//当在Service实现类中 使用 @Autowired 注入DAO时一定要加上  @EnableAutoConfiguration ,否则，@Autowired 会报错
@EnableAutoConfiguration
public class WebApplication  extends WebMvcConfigurerAdapter {

	public static void main(String[] args) {
		SpringApplication.run(WebApplication.class, args);
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new WebRequestInterceptor());
	}
}
